package com.example.business.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.base.utils.SpringContextUtils;
import com.example.business.service.SysVideoService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;

/**
 * <p>
 * 
 * </p>
 *
 * @author xiong
 * @since 2024-01-28
 */

@Data
@ApiModel(description = "")
@TableName("sys_video_play_record")
public class SysVideoPlayRecord implements Serializable {

    private static final long serialVersionUID = 1L;

        /**
    * 主键
    */
    @TableId(value="id", type= IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer id;
    /**
    * 播放的视频名称
    */
    @ApiModelProperty(value = "播放的视频名称")
    private String filename;
    /**
    * 播放的视频id
    */
    @ApiModelProperty(value = "播放的视频id")
    private String fileid;
    /**
    * 播放的视频地址
    */
    @ApiModelProperty(value = "播放的视频地址")
    private String m3u8url;
    /**
    * 播放的ip
    */
    @ApiModelProperty(value = "播放的ip")
    private String ip;
    /**
    * 创建时间
    */
    @ApiModelProperty(value = "创建时间")
    private Date createdate;

    @TableField(exist = false)
    private SysVideo sysVideo;


    public SysVideo getSysVideo() {
        if(this.fileid!=null){
            SysVideoService service=SpringContextUtils.getBean(SysVideoService.class);
            return service.getById(this.fileid);
        }
        return null;
    }
}
